home *** CD-ROM | disk | FTP | other *** search
/ Aminet 12 / Aminet 12 (1996)(GTI - Schatztruhe)[!][Jun 1996].iso / Aminet / dev / e / eiffel.lha / flc / framework / STACK < prev   
Encoding:
Text File  |  1996-01-26  |  559 b   |  30 lines

  1.  
  2. -- a STACK is a LIFO (last in, first out) collection.
  3. -- Time complexity for data adding is O(1).
  4. -- Time complexity for data searching is O(1).
  5. -- Space complexity is O(n).
  6.  
  7. indexing
  8.  
  9.   names: stack;
  10.   contents: generic;
  11.  
  12.   author: "Guichard Damien";
  13.   created: 9,November,1995;
  14.   modified: 9,November,1995
  15.  
  16. class STACK inherit BAG
  17.   rename add as push, next as top
  18.   export {NONE} find
  19.   end
  20. feature
  21.   pop is
  22.     -- Remove top element of the stack.
  23.     do
  24.       if next /= Void then
  25.         next := next.next
  26.       end
  27.     end -- pop
  28. end -- class 'STACK'
  29.  
  30.